<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue中的列表渲染</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id='app'>
        <template v-for="(item,index) of list" :key="item.id">
            <div>{{item.text}}---{{index}}</div>
            <span>{{item.text}}</span>
        </template>
    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                list: [
                    {
                        id: '1',
                        text: 'hello'
                    }, {
                        id: '2',
                        text: 'hello222'
                    }, {
                        id: '3',
                        text: 'xiaolin'
                    }
                ]
            }
        })
    </script>
</body>

</html>